<?php 
	if(!empty($output['params']) && is_array($output['params'])){
	 $encodeType = isset ( $output['params'] ['encoding'] ) ? $output['params'] ['encoding'] : 'UTF-8';
?>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $encodeType; ?>" />
</head>
<body  onload="javascript:document.pay_form.submit();">
    <form id="pay_form" name="pay_form" action="<?php echo $output['link'];?>" method="post">
	<?php foreach ($output['params'] as $key => $value ){ ?>
	 <input type="hidden" name="<?php echo $key; ?>" id="<?php echo $key; ?>" value="<?php echo $value; ?>" />
	<?php } ?>
    <input type="submit" type="hidden" style="display:none">
    </form>
</body>
</html>

<?php }else{ ?>

<script type="text/javascript" charset="utf-8">
var ws=null,embed=null;
// 扩展API加载完毕，现在可以正常调用扩展API 
function plusReady(){
	ws=plus.webview.currentWebview();
	embed=plus.webview.create("<?php echo $output['link']; ?>","embed",{top:"0px",bottom:"0px"});
	ws.append(embed);
	embed.addEventListener("loaded",onBrowserLoading,false);
}
// 判断扩展API是否准备，否则监听"plusready"事件
if(window.plus){
	plusReady();
}else{
	document.addEventListener("plusready",plusReady,false);
}

// 页面加载后自动打开
document.addEventListener("DOMContentLoaded",function(){
	if(embed){
		openUrl();
	}else{
		auto=true;
	}
},false);
// 页面跳转完成事件
function onBrowserLoading(){
	document.getElementById("url").value=embed.getURL();
}
</script>
<?php }?>